package org.giovanolli.mumi.service.impl;

import java.util.List;

import org.giovanolli.mumi.dao.Dao;
import org.giovanolli.mumi.dao.PermissionDao;
import org.giovanolli.mumi.dao.RoleDao;
import org.giovanolli.mumi.entities.filter.PermissionFilter;
import org.giovanolli.mumi.entities.filter.RoleFilter;
import org.giovanolli.mumi.entities.security.Permission;
import org.giovanolli.mumi.entities.security.Role;
import org.giovanolli.mumi.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("roleService")
public class RoleServiceImpl extends AbstractService<Role> implements RoleService {

	@Autowired
	private RoleDao roleDao;

	@Autowired
	private PermissionDao permissionDao;

	@Override
	@Transactional(readOnly = true)
	public List<Permission> getAllPermissions() {
		return permissionDao.getList(new PermissionFilter());
	}

	@Transactional(readOnly = true)
	public List<Role> getList(Role example) {
		return roleDao.getList(new RoleFilter());
	}

	@Override
	protected Dao<Role> getServiceDao() {
		return roleDao;
	}
}
